package uit.comstore.model.blo;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;

import uit.comstore.model.entity.ImportBill;
import uit.comstore.utils.HibernateSessionFactory;

public class ImportBillBLO {
	@SuppressWarnings("unchecked")
	public List<ImportBill> list() {
		List<ImportBill> importBill = null;
		Session session = HibernateSessionFactory.getSessionFactory().getCurrentSession();	
		session.beginTransaction();
		Query query = session.createQuery("from ImportBill");
		importBill = query.list();
		session.getTransaction().commit();
		return importBill;
	}
	
	public ImportBill add(ImportBill importBill) {
		Session session = HibernateSessionFactory.getSessionFactory().getCurrentSession();
		session.beginTransaction();
		session.save(importBill);
		session.getTransaction().commit();
		return importBill;
	}
}
